package com.example.server.service.impl;

import com.example.server.entity.Book;
import com.example.server.mapper.BookMapper;
import com.example.server.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BookServiceImpl implements BookService {

    @Autowired
    private BookMapper bookMapper;

    @Override
    public Book getBookById(int idbook) {
        return bookMapper.getBookById(idbook);
    }

    @Override
    public List<Book> getAllBooks() {
        return bookMapper.getAllBooks();
    }

    @Override
    public void insertBook(Book book) {
        bookMapper.insertBook(book);
    }

    @Override
    public void updateBook(Book book) {
        bookMapper.updateBook(book);
    }

    @Override
    public void deleteBook(int idbook) {
        bookMapper.deleteBook(idbook);
    }

    @Override
    public void incrementClicks(int idbook) {
        bookMapper.incrementClicks(idbook);
    }

    @Override
    public List<Book> getBooksByIds(List<Integer> ids) {
        return bookMapper.getBooksByIds(ids);
    }
}
